Xbasic

CAN_APPLICATION_EXIT Function

Syntax

C can_application_exit(C code )

Arguments

code

A character string containing lines of Xbasic to be executed.

Description

Registers code to be executed before the application is closed. If Cancel() is called, the application is not closed.

Discussion

The CAN_APPLICATION_EXIT() function allows you to "register" code that will be executed when the application is about to be closed. This will be called whenever a5.close() is called, or whenever the user presses the red 'X' button on the top level window.

Example

dim code as C
dim ret as N
code = <<%code%
ret = ui_msg_box("Notice", "Are you sure you want to exit?",UI_YES_NO)
if (ret = UI_NO_SELECTED) then
    CANCEL()
end if
%code%
can_application_exit(code)

See Also